(deftemplate Pacient
    "Diagnostic medical"
    (slot numePacient)
    (slot culoarePiele)
    (slot culoareOchi)
    (slot temperatura(type INTEGER))
    (slot tusa(allowed-values TRUE FALSE))
    (slot durereCap(allowed-values TRUE FALSE))
    (slot durereGat(allowed-values TRUE FALSE))
    (slot durereFicat(allowed-values TRUE FALSE))
    (slot senzatieDeNisipInOchi(allowed-values TRUE FALSE))
)

(defrule rule1(Pacient(numePacient ?nP){temperatura >= 29} (tusa TRUE)(culoareOchi rosii)(durereCap TRUE)(durereGat TRUE))=> 
	(printout t "Pacientul " ?nP " are gripa" crlf))

(defrule rule2(Pacient(numePacient ?nP)(tusa FALSE)(temperatura ?t)(culoarePiele galben)(durereCap TRUE)(durereGat FALSE)(durereFicat TRUE)) => 
	(printout t "Pacientul " ?nP " are hepatita" crlf))

(defrule rule3(Pacient(numePacient ?nP)(culoareOchi rosii)(senzatieDeNisipInOchi TRUE)) => 
	(printout t "Pacientul " ?nP " are conjunctivita" crlf))

(defrule rule4(declare (salience 1))(Pacient(numePacient ?nP)(culoareOchi rosii)) => 
	(printout t "Pacientul " ?nP " ar putea avea conjuntivita" crlf))

(defrule rule5(declare (salience 2))(Pacient(numePacient ?nP)(culoareOchi rosii)) => 
	(printout t "Pacientul " ?nP " a stat mult in fata calculatorului!"))

(assert (Pacient(numePacient Ion)(culoareOchi rosii)(temperatura 31)(tusa TRUE)(durereCap TRUE)(durereGat TRUE)(durereFicat FALSE)(senzatieDeNisipInOchi FALSE)))
(assert (Pacient(numePacient Vasile)(temperatura 25)(tusa FALSE)(culoarePiele galben)(durereCap TRUE)(durereGat FALSE)(durereFicat TRUE)))
(assert (Pacient(numePacient Alexandru)(temperatura 20)(durereCap FALSE)(culoareOchi rosii)(senzatieDeNisipInOchi TRUE)))

(run)
(reset)


